import WoundClosure
from frontend.roleApplication import RoleApplication
from frontend.form import Type

class SurgeonApplication(RoleApplication):
 
    def __init__(self):
        super(SurgeonApplication, self).__init__("Team1OR", "Surgeon") 
        self.register_source_step("StartSurgery", self.start_surgery_form_creator) 
        self.register_transition_step("RequestInstrument", self.request_instrument_form_creator, name_fields=["sequence","PatientName","InstrumentNumber"]) 
        self.register_transition_step("IsAnotherInstrument", self.is_another_instrument_form_creator, name_fields=["sequence","PatientName","InstrumentNumber"]) 
        self.register_transition_step("IsWoundClosure", self.is_wound_closure_form_creator, name_fields=["sequence","PatientName"]) 
        self.register_transition_step("WoundClosure", self.create_wound_closure_form, name_fields=["sequence","PatientName"]) 


    def start_surgery_form_creator(self, stepname, form):
        form.add_static_label('Patient Name:') 
        form.add_field(Type.SHORTSTRING, "PatientName")
        form.add_static_label('Surgery Type:') 
        form.add_field(Type.SHORTSTRING, "SurgeryType")
  
    def request_instrument_form_creator(self, stepname, form):
        form.add_static_label('Instrument Name:')  
        form.add_field(Type.SHORTSTRING, "InstrumentName") 
        form.add_static_label('Perform:') 
       
    def is_another_instrument_form_creator(self, stepname, form):
        form.add_static_label('Another instrument?') 
        form.add_field(Type.BOOLEAN, "IsAnotherInstrument")

    def is_wound_closure_form_creator(self, stepname, form):
        form.add_static_label('Perform Wound Closure?') 
        form.add_field(Type.BOOLEAN, "IsWoundClosure")
           
    def create_wound_closure_form(self, stepname, form):
        WoundClosure.create_wound_closure_form(self,stepname,form)
     


if __name__ == '__main__':
    app = SurgeonApplication()
    app.MainLoop()